import type { App, Component } from 'vue';

interface ModuleType {
	[key: string]: Component;
}
export default function registerLocalComponent(app: App) {
	const modules = import.meta.glob<true, string, ModuleType>('./**/index.{ts,tsx}', {
		eager: true,
	});
	Object.keys(modules).forEach(key => {
		const componentName = key.replace(/\.\/|\/index\.(ts|tsx)/g, '');
		if (componentName.startsWith('Lc') || componentName.startsWith('Ln')) {
			app.component(componentName, modules[key][componentName]);
		}
	});
}
